package crystal.workshop.ui;

import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Collection;

import javax.swing.event.ListDataListener;

import crystal.workshop.StructureSource;

public interface StructuresListModel extends Serializable {
	
	/**
	 * Get the collection of structures contained by this list.
	 * @return the collection of structures.
	 */
	public Collection<StructureDataModel> getStructures();
	
	public void updateStructure(final StructureDataModel str);
	
	public void addPropertyChangeListener(final PropertyChangeListener listener);
	
	public void removePropertyChangeListener(final PropertyChangeListener listener);
	
	public void addListDataListener(final ListDataListener l); 
	
	public void removeListDataListener(final ListDataListener l);
	
	/**
	 * Add a single structure to the list.
	 * @param str the structure
	 * @param source the source of the structure
	 */
	public void add(final StructureDataModel str, final StructureSource source);
	
	/**
	 * Add a collection of structures all from the same source.
	 * @param strs the structures collection
	 * @param source the source of the structures
	 */
	public void addAll(final Collection<? extends StructureDataModel> strs,
			final StructureSource source );
	
	
	/**
	 * Remove a particular structure from the list
	 * @param str the structure to remove
	 */
	public void remove(final StructureDataModel str);
	
	/**
	 * Get the number of structures contained in this list.
	 * @return the size of the list
	 */
	public int getSize();
	
	public StructureDataModel getStructure(final int index);
	
	/**
	 * Find a structure by its name.
	 * @param name the name of the structure.
	 * @return the structure data model or null if not found.
	 */
	public StructureDataModel find(final String name);
}
